from flask import Flask,jsonify
import json

app = Flask(__name__)
@app.route('/')
def index():
    data ={
        'name':'wangwu',
        'age':18
    }
    # 1.使用json模块
    # return json.dumps(data),200,{'Content-Type':'application/json'}

    #2.使用jsonify
    # return jsonify(data)
    return jsonify(name='laowang',age=18)

if __name__ == '__main__':
    app.run(debug=True)